import axios from 'axios'

// 设置请求拦截器
axios.interceptors.request.use(
  config => {
    //先从浏览器的localStorage存储中提取token值
    const tokenStr = localStorage.getItem('token')
    if (tokenStr) {
      config.headers.token = tokenStr
    }
    return config
  })

axios.defaults.withCredentials = true; // 允许跨域请求的时候携带cookie
var myurl = 'http://localhost:8080/' //基础路径地址

export function login(data) {
  const url = `login`
  // const mydata = `adminAccount=${data.adminAccount}&adminPassword=${data.adminPassword}`
  return axios.post(myurl + url, data)
}

  export default {
    login,
  }
  
